package com.winter.Controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.Friend;
import com.winter.service.FriendService;
import com.winter.util.Result;

@RestController
@RequestMapping("/friend")
public class FriendController {
	
	@Resource
	private FriendService friendService;
	
	/*
	 * 添加好友
	 * 
	 */
	
    @PostMapping("/saveFriend")
    public Result saveFriend(@RequestBody Friend friend) {
		return friendService.saveFriend(friend);
	}
    
    /*
     * 
     * 只有status=3才能删除好友
     */
    @GetMapping("deleteFriend")
    public Result deleteFriend(String userNo,String companyUser){
    	return friendService.deleteFriend(userNo,companyUser);
    }
    
    /*
     * 只有status=1才能审核
     * 
     */
    @GetMapping("sendFriend")
    public Result sendFriend(String userNo,String companyUser){
    	return friendService.sendFriend(userNo,companyUser);
    }
    
    /*
     * 我的好友列表
     * 
     */
    @GetMapping("friendList")
    public Result friendList(Integer pageNumber, Integer pageSize,String userNo){
		return friendService.friendList(pageNumber, pageSize, userNo);
    	
    }
}
